package com.stellar.circle.controller.admin.sPostLike;

import com.stellar.circle.controller.admin.sPostLike.vo.SPostLikeRequestPageVO;
import com.stellar.circle.controller.admin.sPostLike.vo.SPostLikeRequestVO;
import com.stellar.circle.controller.admin.sPostLike.vo.SPostLikeResponseVO;
import com.stellar.circle.domain.sPostLike.SPostLikeDomainService;

import com.stellar.web.core.bean.PageResult;
import com.stellar.web.core.bean.Result;
import com.stellar.web.core.validator.ValidatorRole;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 帖子点赞表控制器
 *
 * @author Jqchan
 * @version 1.0
 * @date 2025-05-19 14:23:03
 */
@RequestMapping("/api-admin/sPostLike")
@RestController("adminSPostLikeController")
@Slf4j
public class SPostLikeController {

    @Resource
    private SPostLikeDomainService sPostLikeDomainService;

    /**
     * 分页查询帖子点赞表
     */
    @ValidatorRole
    @PostMapping("/page")
    public Result<PageResult<SPostLikeResponseVO>> page(@RequestBody SPostLikeRequestPageVO requestPageVO) {
        return Result.success(sPostLikeDomainService.page(requestPageVO));
    }

    /**
     * 新增帖子点赞表
     */
    @ValidatorRole
    @PostMapping("/create")
    public Result<Boolean> create(@RequestBody SPostLikeRequestVO requestVO) {
        return Result.success(sPostLikeDomainService.insert(requestVO));
    }

    /**
     * 修改帖子点赞表
     */
    @ValidatorRole
    @PostMapping("/update")
    public Result<Boolean> update(@RequestBody SPostLikeRequestVO requestVO) {
        return Result.success(sPostLikeDomainService.update(requestVO));
    }

    /**
     * 删除帖子点赞表
     */
    @DeleteMapping("/delete/{id}")
    public Result<Boolean> delete(@PathVariable("id") Long id) {
        return Result.success(sPostLikeDomainService.delete(id));
    }

    /**
     * 获取帖子点赞表详情
     */
    @ValidatorRole
    @GetMapping("/get/{id}")
    public Result<SPostLikeResponseVO> get(@PathVariable("id") Long id) {
        return Result.success(sPostLikeDomainService.get(id));
    }
}
